home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Dev / misc / temgen.lha / Temgen / Amigamain / generic.tg < prev    next >
Text File  |  2004-06-26  |  22KB  |  868 lines

  1. # generic.tg
  2. # universal TemGen template to generate amigamain.c and amigamain.h
  3. # support for libraries, tooltypes, readargs, locale
  4.  
  5.  
  6. @ $true = 1
  7. @ $false = 0
  8.  
  9.  
  10. # ************************************************************
  11. # Configuration part I
  12. # (part II is at end of file)
  13. # ************************************************************
  14.  
  15. # Version string "Name Version.Revision (Day.Month.Year)"
  16. @ $version = "MyApp 0.1 (1.1.2004)"
  17.  
  18. # start function, cleanup function and header file
  19. @ $application = ["APP_run()", "APP_clean()", "app.h"]
  20.  
  21. # true forbids start from Workbech
  22. @ $forbidwb = $false
  23.  
  24. # true forbids start from Shell
  25. @ $forbidcli = $false
  26.  
  27. # true inserts code to reopen Output(), stdin and stdout as con:
  28. # only useful for start from Workbench
  29. @ $opencon = $true
  30.  
  31. # delay in 1/50 seconds after cleanup
  32. # only used when opencon is true
  33. # this gives the user some time to read the message in the con: windows
  34. @ $delay = 200
  35.  
  36. # vmessagef function uses EasyRequest
  37. @ $message_request = $true
  38.  
  39. # vmessagef function prints to Output()
  40. @ $message_output = $true
  41.  
  42. # Title for EasyRequest, only used in non locale mode
  43. @ $request_title = "APP Problem"
  44.  
  45. # tooltypes support
  46. @ $tooltypes = $true
  47.  
  48. # ReadArgs support
  49. @ $readargs = $true
  50.  
  51. # Locale support
  52. @ $locale = $true
  53. @ $loc_builtin = "english"
  54. @ $loc_header = "app_strings.h"
  55. @ $loc_catalog = "app.catalog"
  56.  
  57. # ************************************************************
  58. # End of configuration part I
  59. # ************************************************************
  60.  
  61. # variable initialisation, don't change
  62. @ $argtemplate = ""
  63. @ $argnr = 0
  64. @ if ( $locale )
  65. @   $messagefunc = "messagef_loc"
  66. @ else
  67. @   $messagefunc = "messagef"
  68. @ endif
  69.  
  70. # ************************************************************
  71. # amigamain.c
  72. # ************************************************************
  73.  
  74. @output "amigamain.c"
  75.  
  76. # ============================================================
  77. # includes
  78. # ============================================================
  79.  
  80. \#include <proto/exec.h>
  81. \#include <proto/dos.h>
  82. \#include <proto/intuition.h>
  83.  
  84. @ if ( $tooltypes )
  85. \#include <proto/icon.h>
  86. \#include <workbench/startup.h>
  87. @ endif
  88.  
  89. @ if ( $locale )
  90. \#include <proto/locale.h>
  91. \#define CATCOMP_NUMBERS
  92. \#define CATCOMP_CODE
  93. \#define CATCOMP_BLOCK
  94. \#include \"$loc_header\"
  95. @ endif
  96.  
  97. \#include <stdlib.h>
  98. \#include <stdio.h>
  99. \#include <stdarg.h>
  100. \#include "amigamain.h"
  101.  
  102. @ if ($application[2] != "")
  103. \#include \"$application[2]\"
  104. @ endif
  105.  
  106. \
  107.  
  108. # ============================================================
  109. # variables
  110. # ============================================================
  111.  
  112. struct Config config;
  113. char *vers=\"\\0\$VER: $version\";
  114. static BPTR oldout, newout;
  115. \
  116.  
  117. @ embed "libbase"
  118.  
  119. @ if ( $locale )
  120. struct LocaleBase *LocaleBase = NULL;
  121. struct LocaleInfo li;  /* extern */
  122. @ endif
  123.  
  124. \
  125.  
  126. @ if ( !$locale )
  127. \#define MSG_OK            "OK"
  128. \#define MSG_REQTITLE      \"$request_title\"
  129. \#define MSG_ERR_LIB       "Couldn't open %s V%ld\\n"
  130. \#define MSG_ERR_SHELL     "Application can't be started from Shell\\n"
  131. \#define MSG_ERR_WB        "Application can't be started from Workbench\\n"
  132. \#define MSG_ERR_RAM       "Couldn't allocate RAM in function %s\\n"
  133. \#define MSG_ERR_TOOLTYPES "Couldn't read tooltypes\\n"
  134. \#define MSG_ERR_READARGS  "Couldn't read command line arguments\\n"
  135. \#define MSG_ERR_OPEN      "Couldn't open stream %s\\n"
  136. @ endif
  137.  
  138. \
  139. # ============================================================
  140. # prototypes
  141. # ============================================================
  142.  
  143. static void cleanexit( void );
  144. static struct Library *save_open_library( UBYTE *libName, ULONG version);
  145.  
  146. @ if ( $tooltypes )
  147. static void handle_tooltypes( struct WBStartup *wbmessage );
  148. @ endif
  149.  
  150. @ if ( $readargs )
  151. static void handle_readargs( void );
  152. @ endif
  153.  
  154. \
  155.  
  156. # ============================================================
  157. # main
  158. # ============================================================
  159.  
  160. int
  161. main(int argc, char *argv[] )
  162. {
  163.     atexit( cleanexit );
  164.  
  165. @ if ( $locale )
  166.     if (LocaleBase = (struct LocaleBase*) OpenLibrary("locale.library",38))
  167.     {
  168.         li.li_LocaleBase = LocaleBase;
  169.         li.li_Catalog    = OpenCatalog(NULL , \"$loc_catalog\" ,
  170.             OC_BuiltInLanguage , (ULONG)\"$loc_builtin\" , TAG_DONE );
  171.     }
  172. @ endif
  173.  
  174. @ embed "config_init"
  175.  
  176.     if ( argc == 0 )
  177.     {
  178.         /* started from Workbench */
  179.         config.start_from_wb = TRUE;
  180.  
  181. @ if ( $opencon )
  182.         if ( ! freopen( "con:10/50/300/100/stdin/AUTO"  , "r", stdin  ))
  183.         {
  184.             $messagefunc\( MSG_ERR_OPEN, "'stdin'" );
  185.             exit( EXIT_FAILURE );
  186.         }
  187.  
  188.         if ( ! freopen( "con:10/150/300/100/stdout/AUTO", "w", stdout ))
  189.         {
  190.             $messagefunc\( MSG_ERR_OPEN, "'stdout'" );
  191.             exit( EXIT_FAILURE );
  192.         }
  193. \
  194.         newout = Open("con:10/250/300/100/AmigaDos/AUTO", MODE_OLDFILE);
  195.         if ( ! newout )
  196.         {
  197.             $messagefunc\( MSG_ERR_OPEN, "'AmigaDos'" );
  198.             exit( EXIT_FAILURE );
  199.         }
  200.         oldout = SelectOutput(newout );
  201. @ endif
  202.     }
  203.  
  204. @ embed "libopen"
  205.  
  206.     config.all_libraries_open = TRUE;
  207.  
  208.     if ( config.start_from_wb )
  209.     {
  210.  
  211. @ if ( $forbidwb )
  212.         $messagefunc\( MSG_ERR_WB );
  213.         exit( EXIT_FAILURE );
  214. @ endif
  215.  
  216. @ if ( $tooltypes )
  217.         handle_tooltypes( (struct WBStartup *) argv );
  218. @ endif
  219.  
  220.     }
  221.     else
  222.     {
  223.  
  224. @ if ( $forbidcli )
  225.         $messagefunc\( MSG_ERR_SHELL );
  226.         exit( EXIT_FAILURE );
  227. @ endif
  228.  
  229. @ if ( $readargs )
  230.         handle_readargs();
  231. @ endif
  232.  
  233.     }
  234. @ if ($application[0] != "")
  235.     $application[0];
  236. @ endif
  237.  
  238.     return EXIT_SUCCESS;
  239. }
  240. \
  241. # ============================================================
  242. # show_request
  243. # ============================================================
  244.  
  245. /*
  246.   open EasyRequest
  247. */
  248. LONG
  249. show_request( char *title, char *text, char *button, ... )
  250. {
  251.     va_list ap;
  252.     va_start(ap, button );
  253.     return show_request_args(title, text, button, ap);
  254.     va_end(ap );
  255. }
  256. \
  257.  
  258. # ============================================================
  259. # show_request_args
  260. # ============================================================
  261.  
  262. /*
  263.   open EasyRequest (va_list)
  264. */
  265. LONG
  266. show_request_args( char *title, char *text, char *button, va_list ap )
  267. {
  268.     struct EasyStruct es = {sizeof (struct EasyStruct), 0, 0, 0, 0};
  269.  
  270.     es.es_Title = title;
  271.     es.es_TextFormat = text;
  272.     es.es_GadgetFormat = button;
  273.  
  274.     return EasyRequestArgs(config.reqwin, &es, 0, ap);
  275. }
  276. \
  277.  
  278. # ============================================================
  279. # vmessagef
  280. # ============================================================
  281.  
  282. /*
  283.   formated output to Output() and/or Workbench
  284.   parameters like vprintf
  285. */
  286. void
  287. vmessagef( char *format, va_list ap )
  288. {
  289.     if ( ! format) return;
  290.  
  291.     if ( config.message_output )
  292.     {
  293.         VPrintf(format, ap);
  294.         Flush( Output() );
  295.     }
  296.  
  297.     if ( config.message_request && IntuitionBase )
  298.     {
  299.  
  300. @ if ( $locale )
  301.         show_request_args(
  302.             GetString(&li, MSG_REQTITLE), format,
  303.             GetString(&li , MSG_OK), ap);
  304. @ else
  305.         show_request_args( MSG_REQTITLE, format, MSG_OK, ap);
  306. @ endif
  307.  
  308.     }
  309. }
  310. \
  311.  
  312. # ============================================================
  313. # messagef
  314. # ============================================================
  315.  
  316. /*
  317.   messagef (like printf)
  318. */
  319. void
  320. messagef( char *format, ... )
  321. {
  322.     va_list ap;
  323.  
  324.     va_start(ap, format);
  325.     vmessagef(format, ap);
  326.     va_end(ap);
  327. }
  328. \
  329.  
  330. # ============================================================
  331. # messagef_loc
  332. # ============================================================
  333.  
  334. @ if ( $locale)
  335.  
  336. /*
  337.   message_f with locale support
  338. */
  339. void
  340. messagef_loc( LONG msg_id, ... )
  341. {
  342.     va_list ap;
  343.     char *format;
  344.  
  345.     format = GetString(&li , msg_id);
  346.  
  347.     va_start(ap, msg_id);
  348.     vmessagef(format, ap);
  349.     va_end(ap);
  350. }
  351. \
  352.  
  353. @ endif
  354.  
  355. # ============================================================
  356. # strcpy_malloc
  357. # ============================================================
  358.  
  359. /*
  360.   copies string s to new allocated RAM
  361. */
  362. char *
  363. strcpy_malloc(const char *s )
  364. {
  365.     char *dest;
  366.     if ( ! s)
  367.         return NULL;
  368.  
  369.     dest = malloc( strlen( s ) + 1);
  370.     if ( ! dest )
  371.     {
  372.         $messagefunc\( MSG_ERR_RAM , "strcpy_malloc");
  373.         exit( EXIT_FAILURE );
  374.     }
  375.     strcpy(dest, s);
  376.     return dest;
  377. }
  378. \
  379.  
  380.  
  381. # ============================================================
  382. # save_open_library
  383. # ============================================================
  384.  
  385. /*
  386.   OpenLibrary with check of return value
  387. */
  388. static struct Library *
  389. save_open_library(UBYTE *libName, ULONG version)
  390. {
  391.     struct Library *lib;
  392.     lib = OpenLibrary(libName, version);
  393.     if ( ! lib )
  394.     {
  395.         $messagefunc\( MSG_ERR_LIB ,libName, version );
  396.         exit( EXIT_FAILURE);
  397.     }
  398.     return lib;
  399. }
  400. \
  401.  
  402.  
  403. # ============================================================
  404. # handle_tooltypes
  405. # ============================================================
  406.  
  407. @ if ($tooltypes)
  408.  
  409. /*
  410.   qearies diskobject for tooltype entries
  411. */
  412. static void
  413. handle_tooltypes( struct WBStartup *wbmessage )
  414. {
  415.     struct DiskObject *dobj;
  416.     struct WBArg *wbarg;
  417.     STRPTR *toolarray;
  418.     STRPTR s;
  419.  
  420.     wbarg = wbmessage->sm_ArgList;
  421.     if (( *wbarg->wa_Name ) && ( dobj = GetDiskObject( wbarg->wa_Name )))
  422.     {
  423.         toolarray = dobj->do_ToolTypes;
  424.  
  425. @ embed "tooltype"
  426.  
  427.         FreeDiskObject( dobj );
  428.     }
  429.     else
  430.     {
  431.         $messagefunc\( MSG_ERR_TOOLTYPES );
  432.         exit( EXIT_FAILURE );
  433.     }
  434. }
  435.  
  436. @ endif
  437. \
  438.  
  439.  
  440. # ============================================================
  441. # handle_readargs
  442. # ============================================================
  443.  
  444. @ if ($readargs)
  445.  
  446. /*
  447.   qearies command line args
  448. */
  449. static void
  450. handle_readargs( void )
  451. {
  452.     struct RDArgs *rda;
  453.  
  454. @ embed "initarg"
  455.  
  456.     if ( rda )
  457.     {
  458.  
  459. @ embed "readarg"
  460.  
  461.         FreeArgs(rda );
  462.     }
  463.     else
  464.     {
  465.         $messagefunc\( MSG_ERR_READARGS );
  466.         exit( EXIT_FAILURE );
  467.     }
  468. }
  469.  
  470. \
  471.  
  472. @ endif
  473.  
  474. # ============================================================
  475. # cleanexit
  476. # ============================================================
  477.  
  478. /*
  479.   cleanup function for atexit
  480. */
  481. static void
  482. cleanexit( void )
  483. {
  484.     $application[1];
  485.  
  486. @ if ( $opencon && ( $delay > 0 ))
  487.     if ( config.start_from_wb )
  488.         Delay( $delay );
  489. @ endif
  490.  
  491.     if ( config.all_libraries_open )
  492.     {
  493. @ if ( $locale )
  494.         CloseCatalog(li.li_Catalog);
  495. @ endif
  496.         if ( newout )
  497.         {
  498.             SelectOutput(oldout );
  499.             Close(newout );
  500.         }
  501.     }
  502.  
  503. @ embed "libclose"
  504. @ if ( $locale )
  505.     CloseLibrary((struct Library*)LocaleBase);
  506. @ endif
  507.  
  508. }
  509.  
  510.  
  511. # ************************************************************
  512. # amigamain.h
  513. # ************************************************************
  514.  
  515. @output "amigamain.h"
  516.  
  517. \#ifndef AMIGAMAIN_H
  518. \#define AMIGAMAIN_H
  519. \
  520. \#include <exec/types.h>
  521. \#include <intuition/intuition.h>
  522. \
  523. \#include <stdarg.h>
  524. \
  525. struct Config
  526. {
  527.     /* true if libraries have successful been opened */
  528.     BOOL all_libraries_open;
  529. \
  530.     /* true if application was started from Workbench */
  531.     BOOL start_from_wb;
  532. \
  533.     /* reference window for EasyRequest */
  534.     struct Window *reqwin;
  535. \
  536.  
  537. @ embed "config"
  538. };
  539. \
  540. extern struct Config config;
  541.  
  542. @ if ( $locale)
  543. extern struct LocaleInfo li;
  544. @ endif
  545.  
  546. \
  547. LONG show_request( char *title, char *text, char *button, ... );
  548. LONG show_request_args( char *title, char *text, char *button, va_list ap );
  549. void vmessagef(char *format, va_list ap);
  550. void messagef(char *format, ... );
  551.  
  552. @if ( $locale)
  553. void messagef_loc(LONG msgid, ...);
  554. @ endif
  555.  
  556. char *strcpy_malloc(const char *s );
  557. \
  558. \#endif
  559.  
  560.  
  561. # ************************************************************
  562. # FUNCTIONS
  563. # ************************************************************
  564.  
  565.  
  566. # ============================================================
  567. # function: library
  568. # ============================================================
  569.  
  570. @ function library( basename , libraryname , minversion , basetype)
  571.  
  572. @ emit "libbase"
  573. @ if ( $basetype == "" )
  574. struct Library *$basename = NULL;
  575. @ else
  576. struct $basetype *$basename = NULL;
  577. @ endif
  578.  
  579. @ if ( $libraryname != "" )
  580. @   emit "libopen"
  581. @   if ($basetype == "" )
  582.     $basename = save_open_library(\"$libraryname\", $minversion);
  583. @   else
  584.     $basename = (struct $basetype *)
  585.         save_open_library(\"$libraryname\", $minversion);
  586. @   endif
  587.  
  588. @   emit "libclose"
  589. @   if ( $basetype == "" )
  590.     CloseLibrary($basename );
  591. @   else
  592.     CloseLibrary((struct Library *) $basename );
  593. @   endif
  594. @ endif
  595. @ endfunction
  596.  
  597.  
  598. # ============================================================
  599. # function: add_config
  600. # ============================================================
  601.  
  602. @ function add_config(type, name, default)
  603. @ emit "config"
  604. @ switch ($type)
  605. @   case "S":
  606.     STRPTR $name;
  607. @     break
  608. @   case "B":
  609.     BOOL $name;
  610. @     break
  611. @   case "L":
  612.     LONG $name;
  613. @     break
  614. @   endswitch
  615.  
  616. @ if ( $default  != "" )
  617. @   emit "config_init"
  618.  
  619. @   switch ($type)
  620. @     case "S":
  621.     config.$name = strcpy_malloc( \"$default\" );
  622. @       break
  623. @     case "B":
  624. @     case "L":
  625.     config.$name = $default;
  626. @       break
  627. @     endswitch
  628. @   endif
  629.  
  630.  
  631. @ endfunction
  632.  
  633.  
  634. # ============================================================
  635. # function: add_tooltype
  636. # ============================================================
  637.  
  638. @ function add_tooltype(tooltype, variable, type)
  639. @ emit "tooltype"
  640.         if ( s = FindToolType( toolarray, \"$tooltype\" ))
  641.         {
  642. @ switch $type
  643. @   case "S":
  644.             free( config.$variable );
  645.             config.$variable = strcpy_malloc( s );
  646. @   break
  647. @   case "B":
  648.             config.$variable = TRUE;
  649. @   break
  650. @   case "L":
  651.             config.$variable = atol( s );
  652. @   break
  653.  
  654. @ endswitch
  655.         }
  656. \
  657.  
  658. @ endfunction
  659.  
  660.  
  661. # ============================================================
  662. # function: add_arg
  663. # ============================================================
  664.  
  665. @ function add_arg(arg, variable, type)
  666. @ if ( $argtemplate == "" )
  667. @   $argtemplate = $arg
  668. @ else
  669. @   $argtemplate = $argtemplate + "," + $arg
  670. @ endif
  671.  
  672. @ emit "readarg"
  673.  
  674. @ switch $type
  675. @   case "S":
  676.         if ( options[ $argnr ] )
  677.         {
  678.             free( config.$variable );
  679.             config.$variable = strcpy_malloc( (STRPTR)options[ $argnr ] );
  680.         }
  681. @   break
  682. @   case "B":
  683.         config.$variable = options[ $argnr ] ? TRUE : FALSE;
  684. @   break
  685. @   case "L":
  686.         if ( options[ $argnr] )
  687.         {
  688.             config.$variable = *(LONG *)options[ $argnr ];
  689.         }
  690. @   break
  691.  
  692. @ endswitch
  693.  
  694. @ $argnr++
  695. \
  696.  
  697. @ endfunction
  698.  
  699.  
  700. # ============================================================
  701. # function: finish_arg
  702. # ============================================================
  703. @ function finish_arg()
  704. @ emit "initarg"
  705.     LONG options[ $argnr ] = { 0 };
  706.     rda = ReadArgs( \"$argtemplate\" , options, NULL);
  707.  
  708. @ endfunction
  709.  
  710.  
  711. # ************************************************************
  712. # Configuration Part II
  713. # ************************************************************
  714.  
  715. # ============================================================
  716. # libraries
  717. # $library(basename, libraryname, minversion, basetype)
  718. # if no bastype is specified then basetpye is 'Library'
  719. # remove comment char to switch library call on
  720. # remember: exec and dos are always open
  721. # ============================================================
  722.  
  723. @ $library( "IntuitionBase" , "intuition.library" , 40, "IntuitionBase")
  724.  
  725. @ if ( $tooltypes )
  726. @   $library( "IconBase" , "icon.library" , 40 , "" )
  727. @ endif
  728.  
  729. #@ $library( "AmigaGuideBase"        , "amigaguide.library" , 40 , "" )
  730. #@ $library( "AmlBase"               , "aml.library" , 40 , ""  , "" )
  731. #@ $library( "AslBase"               , "asl.library" , 40 , "" )
  732. #@ $library( "BulletBase"            , "bullet.library" , 40 , "" )
  733. #@ $library( "CxBase"                , "commodities.library" , 40 , "" )
  734. #@ $library( "CyberGfxBase"          , "cybergraphics.library" , 40 , "" )
  735. #@ $library( "DataTypesBase"         , "datatypes.library" , 40 , "" )
  736. #@ $library( "DiskfontBase"          , "diskfont.library" , 40 , "" )
  737. #@ $library( "ExpansionBase"         , "expansion.library" , 40 , "" )
  738. #@ $library( "GadToolsBase"          , "gadtools.library" , 40 , "" )
  739. #@ $library( "GfxBase"               , "graphics.library" , 40 , "" )
  740. #@ $library( "IFFParseBase"          , "iffparse.library" , 40 , "" )
  741. #@ $library( "KeymapBase"            , "keymap.library" , 40 , "" )
  742. #@ $library( "LayersBase"            , "layers.library" , 40 , "" )
  743. #@ $library( "LocaleBase"            , "locale.library" , 40 , "" )
  744. #@ $library( "LowLevelBase"          , "lowlevel.library" , 40 , "" )
  745. #@ $library( "MathBase"              , "mathffp.library" , 37 , "" )
  746. #@ $library( "MathIeeeDoubBasBase"   , "mathieeedoubbas.library" , 37 , "" )
  747. #@ $library( "MathIeeeDoubTransBase" , "mathieeedoubtrans.library" , 37 , "" )
  748. #@ $library( "MathIeeeSingBasBase"   , "mathieeesingbas.library" , 37 , "" )
  749. #@ $library( "MathIeeeSingTransBase" , "mathieeesingtrans.library" , 37 , "" )
  750. #@ $library( "MathTransBase"         , "mathtrans.library" , 37 , "" )
  751. #@ $library( "NVBase"                , "nonvolatile.library" , 40 , "" )
  752. #@ $library( "RealTimeBase"          , "realtime.library" , 40 , "" )
  753. #@ $library( "ResourceBase"          , "resource.library" , 40 , "" )
  754. #@ $library( "RexxSysBase"           , "rexxsyslib.library" , 40 , "" )
  755. #@ $library( "UtilityBase"           , "utility.library" , 40 , "" )
  756. #@ $library( "WorkbenchBase"         , "workbench.library" , 40 , "" )
  757.  
  758. # Classes
  759. # -------
  760. #@ $library( "ARexxBase"     , "arexx.class" , 44 , "" )
  761. #@ $library( "RequesterBase" , "requester.class" , 42 , "" )
  762. #@ $library( "WindowBase"    , "window.class" , 44 , "" )
  763.  
  764. # Gadgets
  765. # -------
  766. #@ $library( "ButtonBase"        , "gadgets/button.gadget" , 44 , "" )
  767. #@ $library( "CheckBoxBase"      , "gadgets/checkbox.gadget" , 44 , "" )
  768. #@ $library( "ChooserBase"       , "gadgets/chooser.gadget" , 44 , "" )
  769. #@ $library( "ClickTabBase"      , "gadgets/clicktab.gadget" , 44 , "" )
  770. #@ $library( "ColorWheelBase"    , "gadgets/colorwheel.gadget" , 44 , "" )
  771. #@ $library( "DateBrowserBase"   , "gadgets/datebrowser.gadget" , 44 , "" )
  772. #@ $library( "FuelGaugeBase"     , "gadgets/fuelgauge.gadget" , 44 , "" )
  773. #@ $library( "GetFileBase"       , "gadgets/getfile.gadget" , 44 , "" )
  774. #@ $library( "GetFontBase"       , "gadgets/getfont.gadget" , 44 , "" )
  775. #@ $library( "GetScreenModeBase" , "gadgets/getscreenmode.gadget" , 44 , "" )
  776. #@ $library( "IntegerBase"       , "gadgets/integer.gadget" , 44 , "" )
  777. #@ $library( "LayoutBase"        , "gadgets/layout.gadget" , 44 , "" )
  778. #@ $library( "ListBrowserBase"   , "gadgets/listbrowser.gadget" , 44 , "" )
  779. #@ $library( "PaletteBase"       , "gadgets/palette.gadget" , 44 , "" )
  780. #@ $library( "PopCycleBase"      , "gadgets/popcycle.gadget" , 44 , "" )
  781. #@ $library( "RadioButtonBase"   , "gadgets/radiobutton.gadget" , 44 , "" )
  782. #@ $library( "ScrollerBase"      , "gadgets/scroller.gadget" , 44 , "" )
  783. #@ $library( "SliderBase"        , "gadgets/slider.gadget" , 44 , "" )
  784. #@ $library( "SpaceBase"         , "gadgets/space.gadget" , 44 , "" )
  785. #@ $library( "SpeedBarBase"      , "gadgets/speedbar.gadget" , 44 , "" )
  786. #@ $library( "StringBase"        , "gadgets/string.gadget" , 44 , "" )
  787. #@ $library( "TextEditorBase"    , "gadgets/texteditor.gadget" , 15 , "" )
  788. #@ $library( "VirtualBase"       , "gadgets/virtual.gadget" , 44 , "" )
  789.  
  790. # Images
  791. # ------
  792. #@ $library( "BevelBase"    , "images/bevel.image" , 44 , "" )
  793. #@ $library( "BitMapBase"   , "images/bitmap.image" , 44 , "" )
  794. #@ $library( "DrawListBase" , "images/drawlist.image" , 44 , "" )
  795. #@ $library( "GlyphBase"    , "images/glyph.image" , 44 , "" )
  796. #@ $library( "LabelBase"    , "images/label.image" , 44 , "" )
  797. #@ $library( "PenMapBase"   , "images/penmap.image" , 44 , "" )
  798.  
  799. # Resources
  800. # ---------
  801. #@ $library( "BattClockBase"  , "" , 0 , "" )
  802. #@ $library( "BattMemBase"    , "" , 0 , "" )
  803. #@ $library( "CardResource"   , "" , 0 , "" )
  804. #@ $library( "DiskBase"       , "" , 0 , "" )
  805. #@ $library( "MiscBase"       , "" , 0 , "" )
  806. #@ $library( "PotgoBase"      , "" , 0 , "" )
  807.  
  808. # Devices
  809. # -------
  810. #@ $library( "ConsoleDevice"  , "" , 0 , "" )
  811. #@ $library( "InputBase"      , "" , 0 , "" )
  812. #@ $library( "RamdriveDevice" , "" , 0 , "" )
  813. #@ $library( "TimerBase"      , "" , 0 , "" )
  814.  
  815.  
  816. # ============================================================
  817. # add entries to struct Config
  818. # @ $add_config( type, variable name, default value)
  819. # type can be: S, B, L
  820. # S: STRPTR, B: BOOL, L: LONG
  821. # ============================================================
  822.  
  823. # don't remove the 2 following
  824. @ $add_config("B", "message_request", $message_request)
  825. @ $add_config("B", "message_output", $message_output)
  826.  
  827. @ $add_config("B", "jingle" , "")
  828. @ $add_config("S", "pubscreen" , "")
  829. @ $add_config("L", "nr", 5)
  830.  
  831.  
  832. # ============================================================
  833. # tooltype entries to query, results are stored in struct Config
  834. # @ $add_tooltype( tooltype, config variable, type)
  835. # the config variables must be created be $add_config()
  836. # type can be S, B or L
  837. # S: string -> the parameter is copied in a new allocated memory
  838. # B: bool   -> if the tooltype exists the config parameter is set TRUE
  839. # L: value  -> parameter is set with atol()
  840. # ============================================================
  841.  
  842. @ $add_tooltype("PUBSCREEN", "pubscreen", "S")
  843. @ $add_tooltype("JINGLE", "jingle", "B")
  844. @ $add_tooltype("NR", "nr", "L")
  845.  
  846.  
  847. # ============================================================
  848. # ReadArg entries to query, results are stored in struct Config
  849. # @ $add_arg( arg, config variable, type)
  850. # the config variables must be created be $add_config()
  851. # type can be S, B or L
  852. # S: string -> the parameter is copied in a new allocated memory
  853. # B: bool   -> if the tooltype exists the config parameter is set TRUE
  854. # L: value  -> parameter is set with atol()
  855. # ============================================================
  856.  
  857. @ $add_arg( "P=PUBSCREEN/K", "pubscreen", "S")
  858. @ $add_arg( "J=JINGLE/S", "jingle", "B")
  859. @ $add_arg( "NR/N", "nr", "L")
  860.  
  861.  
  862. # ============================================================
  863. # call this after the last $add_arg
  864. # ============================================================
  865.  
  866. @ $finish_arg()
  867.  
  868.